<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>锚点 ^ $ 的多行模式，修饰符 "m"</title>
	</head>
	<body>
		<div class="test"></div>
		<script>
			// 【只匹配多行开头的数字】
			let str = `1st place: Winnie
2nd place: Piglet
3rd place: Eeyore`

			console.log(str.match(/^\d/gm).toString())
		</script>

		<script>
			// 【只匹配多行结尾的数字】
			let str2 = `Winnie: 1
Piglet: 2
Eeyore: 3`

			console.log(str2.match(/\d$/gm).toString()) // 1,2,3
		</script>

		<script>
			// 搜索 \n
			let str3 = `Winnie: 1
Piglet: 2
Eeyore: 3`

			console.log(str3.match(/\d\n/gm)) // ['1\n', '2\n']
		</script>
	</body>
</html>
